﻿
Option Strict On : Option Explicit On : Option Compare Binary : Option Infer On

Imports System
Imports System.Collections.ObjectModel
Imports System.Text.RegularExpressions


Namespace Code.Coloriser

    ''' <summary>
    ''' Default code coloriser for SQL
    ''' </summary>
    ''' <remarks></remarks>
    Friend Class SQLCodeColoriser
        Inherits IColorTokenProvider

        Public Overrides ReadOnly Property CaseSensitive() As Boolean
            Get
                Return False
            End Get
        End Property


        Protected Overrides ReadOnly Property CommentRegexStr() As String
            Get
                Return "(?:--\s).*?(?=\r|\n)"
            End Get
        End Property


        Protected Overrides ReadOnly Property StringOrCharRegexStr() As String
            Get
                Return "''|'[^\r\n]*?'"
            End Get
        End Property


        Protected Overrides ReadOnly Property Keywords() As String
            Get
                Return "absolute action ada add admin after aggregate " _
                & "alias all allocate alter and any are array as asc " _
                & "assertion at authorization avg backup before begin " _
                & "between binary bit bit_length blob boolean both breadth " _
                & "break browse bulk by call cascade cascaded case cast " _
                & "catalog char char_length character character_length " _
                & "check checkpoint class clob close clustered coalesce " _
                & "collate collation column commit completion compute " _
                & "connect connection constraint constraints constructor " _
                & "contains containstable continue convert corresponding " _
                & "count create cross cube current current_date current_path " _
                & "current_role current_time current_timestamp current_user " _
                & "cursor cycle data database date day dbcc deallocate dec " _
                & "decimal declare default deferrable deferred delete deny " _
                & "depth deref desc describe descriptor destroy destructor " _
                & "deterministic diagnostics dictionary disconnect disk " _
                & "distinct distributed domain double drop dummy dump " _
                & "dynamic each else end end-exec equals errlvl escape " _
                & "every except exception exec execute exists exit external " _
                & "extract false fetch file fillfactor first float for " _
                & "foreign fortran found free freetext freetexttable from " _
                & "full function general get global go goto grant group " _
                & "grouping having holdlock host hour identity identity_insert " _
                & "identitycol if ignore immediate in include index indicator " _
                & "initialize initially inner inout input insensitive insert " _
                & "int integer intersect interval into is isolation iterate " _
                & "join key kill language large last lateral leading left " _
                & "less level like limit lineno load local localtime localtimestamp " _
                & "locator lower map match max min minute modifies modify " _
                & "module month names national natural nchar nclob new next " _
                & "no nocheck nonclustered none not null nullif numeric object " _
                & "octet_length of off offsets old on only open opendatasource " _
                & "openquery openrowset openxml operation option or order " _
                & "ordinality out outer output over overlaps pad parameter " _
                & "parameters partial pascal path percent plan position " _
                & "postfix precision prefix preorder prepare preserve " _
                & "primary print prior privileges proc procedure " _
                & "public raiserror read reads readtext real reconfigure " _
                & "recursive ref references referencing relative replication " _
                & "restore restrict result return returns revoke right role " _
                & "rollback rollup routine row rowcount rowguidcol rows rule " _
                & "save savepoint schema scope scroll search second section " _
                & "select sequence session session_user set sets setuser " _
                & "shutdown size smallint some space specific specifictype " _
                & "sql sqlca sqlcode sqlerror sqlexception sqlstate sqlwarning " _
                & "start state statement static statistics structure substring " _
                & "sum system_user table temporary terminate textsize than then " _
                & "time timestamp timezone_hour timezone_minute to top trailing " _
                & "tran transaction translate translation treat trigger trim " _
                & "true truncate tsequal under union unique unknown unnest " _
                & "update updatetext upper usage use user using value values " _
                & "varchar variable varying view waitfor when whenever where " _
                & "while with without work write writetext year zone"
            End Get
        End Property


        Protected Overrides ReadOnly Property Preprocessors() As String
            Get
                Return "@@CONNECTIONS @@CPU_BUSY @@CURSOR_ROWS @@DATEFIRST " _
                & "@@DBTS @@ERROR @@FETCH_STATUS @@IDENTITY @@IDLE " _
                & "@@IO_BUSY @@LANGID @@LANGUAGE @@LOCK_TIMEOUT " _
                & "@@MAX_CONNECTIONS @@MAX_PRECISION @@NESTLEVEL @@OPTIONS " _
                & "@@PACK_RECEIVED @@PACK_SENT @@PACKET_ERRORS @@PROCID " _
                & "@@REMSERVER @@ROWCOUNT @@SERVERNAME @@SERVICENAME @@SPID " _
                & "@@TEXTSIZE @@TIMETICKS @@TOTAL_ERRORS @@TOTAL_READ " _
                & "@@TOTAL_WRITE @@TRANCOUNT @@VERSION"
            End Get
        End Property

    End Class

End Namespace





